import axios, { url } from '.';

const find = async (params) => {
    let res = await axios({
        method: "get",
        url: url + "/order",
        params
    })
    return res.data;
}

const getAll = async (params) => {
    let res = await axios({
        method: "get",
        url: url + "/order/all",
        params
    })
    return res.data;
}

const add = async (data) => {
    let res = await axios({
        method: "post",
        url: url + "/order",
        data
    })
    return res.data;
}

const findById = async (id) => {
    let res = await axios({
        method: "get",
        url: url + "/order/" + id
    })
    return res.data
}

const update = async (data) => {
    let res = await axios({
        method: "put",
        url: url + "/order/" + data.id,
        data
    })
    return res.data;
}

const remove = async (id) => {
    let res = await axios({
        method: "delete",
        url: url + "/order/" + id
    })
    return res.data
}

export {
    find, add, findById, update, remove, getAll
}